﻿@using Covenant.Core
@using Covenant.Models.Grunts
@model ImplantTemplate
@{
    Layout = "_ImplantTemplateLayout";
    ViewData["Title"] = "ImplantTemplates";
}
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap pb-2 mb-3">
    <h1 class="h2">Implant Template: <span id="implant-name" class="text-primary">@Html.DisplayFor(model => model.Name)</span></h1>
</div>

<form asp-action="Edit">
    <div asp-validation-summary="All"></div>
    <input asp-for="Id" value="@Model.Id" type="hidden">
    <div class="form-row">
        <div class="form-group col-md-4">
            <label asp-for="Name"></label>
            <input asp-for="Name" value="@Model.Name" class="form-control">
        </div>
        <div class="form-group col-md-8">
            <label asp-for="Description"></label>
            <input asp-for="Description" value="@Model.Description" class="form-control">
        </div>
    </div>
    <div class="form-row">
        <div class="form-group col-md-4">
            <label asp-for="Language"></label>
            <select asp-for="Language" asp-items="Html.GetEnumSelectList<ImplantLanguage>()" class="form-control"></select>
        </div>
        <div class="form-group col-md-4">
            <label asp-for="CommType"></label>
            <select asp-for="CommType" asp-items="Html.GetEnumSelectList<CommunicationType>()" class="form-control"></select>
        </div>
    </div>
    <div class="form-row">
        <div class="form-group col-md-12">
            <label asp-for="StagerCode"></label>
            <textarea asp-for="StagerCode" value="@Model.StagerCode" rows="5" class="form-control border-1"></textarea>
        </div>
    </div>
    <div class="form-row">
        <div class="form-group col-md-12">
            <label asp-for="ExecutorCode"></label>
            <textarea asp-for="ExecutorCode" value="@Model.ExecutorCode" rows="5" class="form-control border-1"></textarea>
        </div>
    </div>
    <button type="submit" class="btn btn-primary"><span data-feather="edit"></span> Edit</button>
</form>

@section Scripts {
    <script type="text/javascript">
        $(document).ready(function() {
            var editor1 = CodeMirror.fromTextArea(document.getElementById("StagerCode"), {
                lineNumbers: true,
                mode: "text/x-csharp"
            });
            var editor2 = CodeMirror.fromTextArea(document.getElementById("ExecutorCode"), {
                lineNumbers: true,
                mode: "text/x-csharp"
            });
        });
    </script>
}
